const koaRouter = require("@koa/router");
const { verifyAuth } = require("../middleware/login.middleware");

const roleRouter = new koaRouter({ prefix: "/klm_api/role" });
const roleController = require("../controller/role.controller");
//直接传方法,容易丢失this
roleRouter.get("/getById/:id", verifyAuth, (...args) =>
  roleController.getById(...args)
);
roleRouter.get("/deleteById/:id", verifyAuth, (...args) =>
  roleController.deleteById(...args)
);
roleRouter.post("/getList", verifyAuth, (...args) =>
  roleController.getList(...args)
);
roleRouter.post("/saveOrUpdate", verifyAuth, (...args) =>
  roleController.saveOrUpdate(...args)
);
module.exports = roleRouter;
